package com.garen.projects.demo.consumer.handler;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
@RequestMapping("/consumer/zk")
public class InfoController {

    public static final String ZK_INFO_QUERY_URL = "http://provider-zk/info";

    @Resource
    private RestTemplate restTemplate;

    @GetMapping("/info")
    public String query() {
        return restTemplate.getForObject(ZK_INFO_QUERY_URL, String.class);
    }
}
